import getRuntimeConfig from "../../runtimeConfig/getRuntimeConfig";
export default {
  template: `
  <yt-table
    ref
    class="webVueAntYtTable _$customClassName$_"
    :selectType="_$selectType$_"
    :canSelect="_$canSelect$_"
    :emptyText="_$emptyText$_"
    v-model:currentRow="_$currentRow$_"
    v-model:selectedRows="_$selectedRows$_"
    v-model:total="_$total$_"
    v-model:current="_$current$_"
    v-model:pageSize="_$pageSize$_"
    :columns="_$data.columns$_"
    :showSizeChanger="_$showSizeChanger$_"
    :pageSizeOptions="_$pageSizeOptions$_"
    :showQuickJumper="_$showQuickJumper$_"
    :disabled="_$disabled$_"
    :hideOnSinglePage="_$hideOnSinglePage$_"
    :dataSource="_$data.dataSource$_">
      <template #cell="{ column, record }">
        <yt-for :data="item in _$data.columns$_" uniqueKey="_&item.dataIndex&_">
          <yt-for-template>
            <template v-if="column.dataIndex === _&item.dataIndex&_" :forKey="_&item.dataIndex&_">
              <yt-template params="record" backgroundType="color" background="" previewType=""  contentHeight="" contentWidth="" customWidth="" customHeight="" minWidth="" maxWidth="" minHeight="" maxHeight="" width="100%" height="100%" yt-dynamicTag="_&item.dataIndex&_" class="customTableTemplate"></yt-template>
            </template>
          </yt-for-template>
        </yt-for>
      </template>
  </yt-table>`,
  clazzType: 'YtTable',
  editConfig:{
    getRuntimeConfig,
    machTemplateAst:(node)=>{
      const nodeInfo = node[Object.keys(node)[0]] || {};
      const attributes = nodeInfo['attributes'] || {};
      const tagName = Object.keys(node)[0];
      if(attributes && attributes['#cell'] == "{ column, record }" ){
        return true
      }
      return false
    },
    requirementField:()=>{
      return 'colStyleArr'
    },
    _$isAddScroll:(tagName)=>{
      return tagName === 'yt-table'
    }
  }
}